<h3>Edit Task</h3>
<?= form_open('user/tasks/create_task');?>
<table width="100%" class="table-condensed" >
 <?php if ($this->ion_auth->in_group('manager')){?>	 
  <tr>
    <td width="10%"><span class="text-error">*</span> For</td>
    <td width="60%">     
    <select name="user" class="span12">
    <option value="">-- Select User -- </option>
    <?php foreach ($users as $user) {?>
    <option value="<?=$user->user_id?>" <?php 
	if(isset($edit)) {
	if($edit['user_id'] == $user->id)
	{
		echo 'selected = "selected"';
		}
	}
	else {
	echo set_select('user',$user->user_id,TRUE);
	}
	?> ><?= $user->username;?></option >
    <?php } }?>
    </select>
    <span ></span>
    </td>
    <td width="20%" class="text-error"><?= form_error('user'); ?></td>
  </tr>
  <tr>
    <td><span class="text-error">*</span> Title</td>
    <td>
    <input type="text" name="title"  value="<?= isset($edit['title']) ? $edit['title'] : set_value('title')?>" class="span12"/></td>
    <td class="text-error"><?= form_error('title'); ?>
    </td>
  </tr>
  <tr>
    <td><span class="text-error">*</span>Description </td>
    <td><textarea name="desc" class="span12"><?= isset($edit['title']) ? $edit['desc'] : set_value('desc')?></textarea></td>
    <td class="text-error"><?= form_error('desc'); ?> </td>
  </tr>
  <tr>
    <td><span class="text-error">*</span> Start Date </td>
    <td><input type="text" name="start_date" id="dpd1"  value="<?= isset($edit['start_date']) ? $edit['start_date'] : set_value('start_date')?>"/>
      <small class="text-error">
      <?= form_error('start_date'); ?>
    </small>
    
    </td>
    <td class="text-error">&nbsp;</td>
  </tr>
  <tr>
    <td><span class="text-error">*</span> Final Due Date</td>
    <td><input type="text" id="dpd2" name="end_date"  value="<?= isset($edit['end_date']) ? $edit['end_date'] : set_value('end_date')?>"/>
      <small class="text-error">
      <?= form_error('end_date'); ?>
    </small>
    
    </td>
    <td class="text-error">&nbsp;</td>
  </tr>
  <tr>
    <td>Priority</td>
    <td>   
    <select name="priority">
    <option value="" >-- Select Priority -- </option>
    <option value="low" <?php 
	if (isset($edit['priority'])) {
	if($edit['priority'] == 'low'){ echo 'selected = "selected"'; } }?> 
	 >Low</option>
    <option value="medium"  <?php if (isset($edit['priority'])) { if($edit['priority'] == 'medium'){ echo 'selected = "selected"'; }}?> >Medium</option>
    <option value="high"  <?php if (isset($edit['priority'])) { if($edit['priority'] == 'high'){ echo 'selected = "selected"'; }}?> >High</option>    
    </select>   
    <small class="text-error">
      <?= form_error('priority'); ?>
    </small>
    </td>
    <td></td>
  </tr>
  <tr>
    <td><input type="text" value="<?= isset($edit['id']) ? $edit['id'] : set_value('edit_id') ?>" name="edit_id" /></td>
    <td><input type="submit" value="Create Task" class="btn btn-info" />
    <input type="reset" class="btn btn-danger"/></td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?= form_close()?>
